package com.jbm.jbmsupplier.zp.utils;

import android.content.Context;

import com.jbm.jbmsupplier.shared.SharedPreferActivity;
import com.jbm.onehome.common.OHInterface;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by 家帮忙 on 2017/5/23.
 */

public class ClassUser {
    private  Context context;
     SharedPreferActivity sharedPreferActivity;
    public ClassUser(Context context) {
        this.context = context;
        sharedPreferActivity=new SharedPreferActivity(context);
    }

    public   int getLogin(){
        return sharedPreferActivity.getLoginid();
    }
    public static OHInterface getOninter(){
        return OHInterface.getG_server();
    }


    // 以当前时间作为文件名
    public static String getCurrentDate() {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy_MM_dd_HHmmss");
        Date curDate = new Date(System.currentTimeMillis());// 获取当前时间
        String str = formatter.format(curDate);
        return str;
    }
    public static String getDate() {
        Calendar c = Calendar.getInstance();
        String year = String.valueOf(c.get(Calendar.YEAR));
        String month = String.valueOf(c.get(Calendar.MONTH));
        String day = String.valueOf(c.get(Calendar.DAY_OF_MONTH) + 1);
        String hour = String.valueOf(c.get(Calendar.HOUR_OF_DAY));
        String mins = String.valueOf(c.get(Calendar.MINUTE));
        StringBuffer sbBuffer = new StringBuffer();
        sbBuffer.append(year + "-" + month + "-" + day + " " + hour + ":"
                + mins);
        return DataFormate.formate(DataFormate.StringF, System.currentTimeMillis());
    }






}
